Closed AlexKolydas closed 6 years ago
It would be helpful if you write the code you are using right now, otherwise the only thing I can do is refer you to the documentation, where everything is clearly explained, including the question you are asking about the withCode(CODE)
method.
private void login() {
Intent intent = StravaLogin.withContext(this)
.withClientID(29519)
.withRedirectURI("strava.com")
.withApprovalPrompt(AUTO)
.withAccessScope(AccessScope.VIEW_PRIVATE_WRITE)
.makeIntent();
startActivityForResult(intent, RQ_LOGIN);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == RQ_LOGIN && resultCode == RESULT_OK && data != null) {
Log.d("Strava code", data.getStringExtra(RESULT_CODE));
AuthenticationConfig config = AuthenticationConfig.create()
.debug()
.build();
AuthenticationAPI api = new AuthenticationAPI(config);
LoginResult result = api.getTokenForApp(AppCredentials.with(29519, "8d55af50a97a9f4b5269670de00bf5e6f4b9942d "))
.withCode(RESULT_CODE)
.execute();
}
}
This is the code i haven't changed anything i believe
I haven't changed any of your code.I just want to understand what to put in the redirecturi and CODE
On Mon, 22 Oct 2018, 14:28 Tomás Ruiz-López, notifications@github.com wrote:
It would be helpful if you write the code you are using right now, otherwise the only thing I can do is refer you to the documentation, where everything is clearly explained, including the question you are asking about the withCode(CODE) method.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SweetzpotAS/StravaZpot-Android/issues/21#issuecomment-431820666, or mute the thread https://github.com/notifications/unsubscribe-auth/Ajpi4zv0_DfvXiikhXWpo1H-OArPnGRoks5unbn6gaJpZM4XzL-e .
Referring to the documentation in the README:
<YOUR_REDIRECT_URL>
must be in the domain you specified when you registered your app in Strava. Of course, strava.com
isn't most likely your domain for the redirect URI.@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == RQ_LOGIN && resultCode == RESULT_OK && data != null) {
String code = data.getStringExtra(StravaLoginActivity.RESULT_CODE);
// Use code to obtain token
}
}
In any case, you also have an example folder here.
i think i manage to do something!Thank you very much!
Hello.I would like you to help me with the redirect uri.I put the same url that i put in the domain callback in stravas page(which is localhost). but i get this error.Can you please help by telling me which url to put?Also the .withCode(CODE) what should i write?Sorry for this but i'm totally new