I am writing the code on Kotlin on Android.
I'd like to get my github username from the access token.
With curl, you can get the information you want to get with the above expression.How should I write this request in kotlin?I wrote a method for obtaining a username using an access token as an argument below, but I cannot submit a request.Perhaps it is because you put the curl command --user in the URL description.How do you describe the command part of curl as HttpURLConnection?I would appreciate it if you could tell me one of them.android java http kotlin curl
I think you can add the following.
Then, the next line is
The constructor argument in
java.net.URL is a string representing the URL, so you cannot add cURL options.Also,
? is not required.The following is sufficient:
See Javadoc for
See below for the GitHub API.
© 2022 OneMinuteCode. All rights reserved.