inrupt / inrupt/solid-client-authn-js
Cannot make authenticated operations with fetch (solid-client-authn-node)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 77
- Forks
- 49
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 32
Description
Hi everyone,
Premise
i have read all the documentations available at solid and inrupt site. i've tried also to post on forum, but still nothing.
Scenario
i have registered an account to Inrupt to have a Pod that i will use to interact with. Then, i d like to login both as admin and as an external user, but without using GUI. So, I have created an account on Inrupt also for all the other users i want to use in the scenario. About the login-with-no-GUI, I've learned from the section " Node.js Script: Single-User Script " in Inrupt Documentation, that to execute this kind of login i need to use a tool called @inrupt/generate-oidc-token that will return a token with some parameters within, that will be used to login .
I m posting the code used as login function, and all seems to work as well.
function logging(sessionID, provider, myClientId, myClientSecret, myRefreshToken){
sessionID += createSessionID();
const session = new Session(
{ },
sessionID
);
try {
session.login({
// Set oidcIssuer to the Solid Identity Provider associated with the credentials.
oidcIssuer: provider,
//An already-registered clientId, which identifies your application to the Solid Identity Provider.
clientId: myClientId,
//An already-registered clientSecret, associated to the Client ID. Like a password
clientSecret: myClientSecret,
//An already-registered refreshToken, which your application can use to get an Access Token.
//Access Tokens allows you to access Resources for which you have been authorized.
refreshToken: myRefreshToken,
// If the refresh token is updated by the Identity Provider, this callback gets invoked.
onNewRefreshToken: (newToken) => {
console.log("New refresh token: ", newToken); //to be stored in some way
//myRefreshToken = newToken;
}
}).then(() => {
if (session.info.isLoggedIn) {
console.log(session.info.clientAppId);
console.log(session.info.webId);
console.log(session.info.expirationDate);
session
.fetch(session.info.webId)
.then((response) => {
return response.text();
})
.then(console.log);
}
});
console.log(session.info.sessionId);
return session;
} catch (error) {
console.log(error);
}
}
After days of focus, i think the problem was in the usage/explanation of this tool.
It prompts me these questions:
-
What Solid Identity Provider do you want to log in to?
Anser was broker.inrupt.com -
Has Your App Been Pre-Registered by The Administrator Of The Pod Server You Are Signing In To?
Answer could be Yes or No -
What Is the Name of the Application You Are Registering?
Answer will be a name like “Something” -
Then i obtain the login link to use to login on inrupt.
considering those informations, even if i m either the admin or an external user that want to access to a Pod, I should still use that tool to login without GUI. Right?
Since i need to login for both admin and external user, i suppose that this tool need to be used still both as admin and external user.
Questions
I need to understand:
-
how to ask these questions as a pod administrator and external users to allow me to get all the tokens for my app / user I want to log in to my pod without using GUI login?
-
The only things i have noticed is that even trying all possible combination of responses to the prompted questions (by the tool) then it redirect me to the login page. So, if i need a login-token for admin/external user, when redirect to the login page, i need to use the relative credentials to the provider (admin-adminCredentials, extUser-extUserCredentials) or always use admin
credentials?
i hope someone could help me to understand how to interact with the tool both as admin or external user
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the session.login and session.fetch calls in the issue's Node.js example, then review the @inrupt/generate-oidc-token flow for broker.inrupt.com. Reproduce the login using the intended administrator and external-user credentials and verify whether each session can fetch its webId; done means the authentication and authorized fetch behavior is clearly explained or corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100