Skip to content

Commit

Permalink
Scope Url Encode
Browse files Browse the repository at this point in the history
  • Loading branch information
omralcrt committed Apr 18, 2019
1 parent 0c3487d commit adfe296
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,23 @@ class LinkedinSignInActivity: Activity() {
}

private fun generateUrl(): String {
val uriBuilder = Uri.parse(AUTHORIZATION_URL)
return Uri.parse(AUTHORIZATION_URL)
.buildUpon()
.appendQueryParameter(RESPONSE_TYPE, CODE)
.appendQueryParameter(CLIENT_ID, this.clientId)
.appendQueryParameter(REDIRECT_URI, this.redirectUri)
.appendQueryParameter(STATE, this.state)
.appendQueryParameter(SCOPE, getScopes()).build().toString()
}

private fun getScopes(): String {
var scopeString = ""
this.scopes?.let {
for (scope in it) {
uriBuilder.appendQueryParameter(SCOPE, scope)
scopeString += "$scope "
}
}

return uriBuilder.build().toString()
return scopeString.dropLast(1)
}

fun getAccessToken(authCode: String) {
Expand Down

0 comments on commit adfe296

Please sign in to comment.